<?php
require('dbconnection.php');

class Image{

  private $result;


  public function __construct() {

    $query="select number, path from pics order by rand() limit 1;";
    $result = mysql_query($query);
    if (!$result)
      throw new Exception("There is no image returned");    



    $this->result = $result;
  }


  function getPictureNumber($result){
    return $result[0];
  }

  function getPicture($result){
    return $result[1];
  }
}



?>